Methods
activationDifference(imgActivations, targetActivations, transformF, activLossF)
Difference between activations of two input images.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
imgActivations |
* | ||
targetActivations |
* | ||
transformF |
* | null | |
activLossF |
* |
- Source:
activationModification(model, originalImage, activationModDict, activationLossF)
Optimize for specified activation modifications.
Parameters:
Name | Type | Description |
---|---|---|
model |
* | |
originalImage |
* | |
activationModDict |
* | |
activationLossF |
* |
- Source:
alertDialog()
Displays alert dialog with message and close callback.
- Source:
App()
All routes go here.
Don't forget to import the components above after adding new route.
baseImageLaplacianPyramid(shape, imgData, nLevels, decorrelate)
Returns image-initialized laplacian pyramid as sum function and individual layer variables.
Parameters:
Name | Type | Description |
---|---|---|
shape |
* | image shape |
imgData |
* | initial image |
nLevels |
* | pyramid layers |
decorrelate |
* | decorrelate colors |
channel()
Visualize a single channel.
- Source:
deepdream()
Maximize 'interestingness' at some layer.
See Mordvintsev et al., 2015.
- Source:
fillCanvasPixelsWithGreyAndAlpha(canvasPixels, greyData, width, height, channel, mult)
Replicates grey pixel array into rgba canvas pixel array.
Parameters:
Name | Type | Description |
---|---|---|
canvasPixels |
* | rgba pixel array |
greyData |
* | single channel pixel array |
width |
* | |
height |
* | |
channel |
* | channel offset in case input contains multiple concatenated channels |
mult |
* | multiply src pixel data (e.g. to convert from normalized 0-1 to 0-255) |
- Source:
fillCanvasPixelsWithRgbAndAlpha(canvasPixels, rgbData, width, height, channel, mult)
Writes rgb pixel array into rgba canvas pixel array.
Parameters:
Name | Type | Description |
---|---|---|
canvasPixels |
* | rgba pixel array |
rgbData |
* | rgb pixel array |
width |
* | |
height |
* | |
channel |
* | channel offset |
mult |
* | multiply src pixel data (e.g. to convert from normalized 0-1 to 0-255) |
- Source:
gaussianKernel3x3(ch)
Computes gaussian 3x3 kernel
Parameters:
Name | Type | Description |
---|---|---|
ch |
* | channels |
getActivationsForLayers(model, image, layers)
Returns list of activation tensors for each layer.
Parameters:
Name | Type | Description |
---|---|---|
model |
* | |
image |
* | |
layers |
* |
- Source:
getAuxModel(model, outputs)
Returns new model with specified outputs.
Parameters:
Name | Type | Description |
---|---|---|
model |
* | |
outputs |
* |
- Source:
getGrayFromCanvasRgba(canvasPixels, grayData, width, height)
Puts red channel of rgba pixel array into single channel pixel array.
Parameters:
Name | Type | Description |
---|---|---|
canvasPixels |
* | rgba pixel array |
grayData |
* | single channel pixel array |
width |
* | |
height |
* |
- Source:
getImageData(img)
Returns ImageData object from image element.
Parameters:
Name | Type | Description |
---|---|---|
img |
* | html image element |
- Source:
getImgDataFromFile(file, cb)
Passes ImageData object from image file to callback
Parameters:
Name | Type | Description |
---|---|---|
file |
* | image file |
cb |
* | callback |
- Source:
getLayerOutputs(model, layers)
Returns output layer tensors.
Parameters:
Name | Type | Description |
---|---|---|
model |
* | |
layers |
* |
- Source:
getRgbFromCanvasRgba(canvasPixels, rgbData, width, height)
Converts rgba pixel array to rgb pixel array.
Parameters:
Name | Type | Description |
---|---|---|
canvasPixels |
* | rgba pixel array |
rgbData |
* | rgb pixel array to write into |
width |
* | |
height |
* |
- Source:
gramStyle(array)
Returns gram matrix of input tensor, normalized by length of flat length.
Parameters:
Name | Type | Description |
---|---|---|
array |
* |
- Source:
imgLaplacianPyramid(imgArray, w, h, ch, batch, decorrelate, nLevels)
Returns input function and variables in naive pixel space parametrization with image initialization.
Parameters:
Name | Type | Description |
---|---|---|
imgArray |
* | input image |
w |
* | width |
h |
* | height |
ch |
* | channels |
batch |
* | batchsize |
decorrelate |
* | decorrelate colors |
nLevels |
* | number of pyramid layers |
inverseDecorrelate(t)
Applies inverse decorrelation: can be used to preserve color values when the input is initalized
with an image and decorrelation is applied afterwards in the computation graph.
Parameters:
Name | Type | Description |
---|---|---|
t |
* | Input tensor |
- Source:
laplacianPyramid(shape, sd, nLevels)
Returns random-initialized laplacian pyramid as sum function and individual layer variables.
Contains outcommented code for fading in pyramid layers.
Parameters:
Name | Type | Description |
---|---|---|
shape |
* | tensor shape |
sd |
* | standard deviation |
nLevels |
* | pyramid layers |
linearDecorrelateColor(t)
Applies linear decorrelation to input tensor.
Parameters:
Name | Type | Description |
---|---|---|
t |
* | Input tensor |
- Source:
loadJSON(file, callback)
Reads json file content from URL and passes it to callback.
Parameters:
Name | Type | Description |
---|---|---|
file |
* | |
callback |
* |
loadJSONFromLocalFile(file, callback)
Reads json file content from local file and passes it to callback.
Parameters:
Name | Type | Description |
---|---|---|
file |
* | |
callback |
* |
makeArray(tensorOrArray)
Returns array of tensors from tensor or array of tensors
Parameters:
Name | Type | Description |
---|---|---|
tensorOrArray |
* |
- Source:
makeLaplacianPyramidFromImgData(shape, imgData, nLevels, invDec)
Returns image-initialized laplacian pyramid as summed image and individual layers.
Parameters:
Name | Type | Description |
---|---|---|
shape |
* | image shape |
imgData |
* | initial image |
nLevels |
* | pyramid layers |
invDec |
* | inverse decorrelate |
meanL1Loss(g1, g2)
Returns mean of absolute differences.
Parameters:
Name | Type | Description |
---|---|---|
g1 |
* | |
g2 |
* |
- Source:
meanL2Loss(g1, g2)
Returns mean of squared differences.
Parameters:
Name | Type | Description |
---|---|---|
g1 |
* | |
g2 |
* |
- Source:
naiveFromImage(imgArray, w, h, ch, batch, decorrelate)
Returns input function and variables with naive pixel space parametrization of an existing image.
Parameters:
Name | Type | Description |
---|---|---|
imgArray |
Uint8Array | Input image data |
w |
* | width |
h |
* | height |
ch |
* | channels |
batch |
* | batchsize |
decorrelate |
* | decorrelate colors |
- Source:
neuron()
Visualize a single neuron of a single channel.
Defaults to the center neuron. When width and height are even numbers, we
choose the neuron in the bottom right of the center 2x2 neurons.
Odd width & height: Even width & height:
+---+---+---+ +---+---+---+---+
| | | | | | | | |
+---+---+---+ +---+---+---+---+
| | X | | | | | | |
+---+---+---+ +---+---+---+---+
| | | | | | | X | |
+---+---+---+ +---+---+---+---+
| | | | |
+---+---+---+---+
- Source:
output(model, options)
Maximize output / class activation.
Parameters:
Name | Type | Description |
---|---|---|
model |
* | |
options |
* |
- Source:
pixelImage(shape, sd, initVal)
Returns randomly initialized input image variables.
Parameters:
Name | Type | Description |
---|---|---|
shape |
* | |
sd |
* | |
initVal |
* |
randImage(w, h, ch, batch, sd, decorrelate, alpha)
Returns input function and variables with naive pixel space parametrization with random initialization.
Parameters:
Name | Type | Description |
---|---|---|
w |
* | width |
h |
* | height |
ch |
* | channels |
batch |
* | batchsize |
sd |
* | standard deviation |
decorrelate |
* | decorrelate colors |
alpha |
* | use alpha channel |
- Source:
randLaplacianPyramid(w, h, ch, batch, sd, decorrelate, nLevels)
Returns input function and variables with laplacian pyramid parametrization and random initialization.
Parameters:
Name | Type | Description |
---|---|---|
w |
* | width |
h |
* | height |
ch |
* | channels |
batch |
* | batchsize |
sd |
* | standard deviation |
decorrelate |
* | decorrelate colors |
nLevels |
* | number of pyramid layers |
- Source:
render() → {*}
Renders this react component
Returns:
the components contents
- Type
- *
showImage(fileReader, cb)
Creates image element from FileReader.
Parameters:
Name | Type | Description |
---|---|---|
fileReader |
* | |
cb |
* |
- Source:
spatial(model, options)
Maximize single "pixel" location
Parameters:
Name | Type | Description |
---|---|---|
model |
* | |
options |
* |
- Source:
style(model, contentImg, styleImg, contentLrs, styleLrs)
Experimental style objective
Parameters:
Name | Type | Description |
---|---|---|
model |
* | |
contentImg |
* | |
styleImg |
* | |
contentLrs |
* | |
styleLrs |
* |
- Source:
toValidRgb(t, decorrelate, sigmoid, normalize)
Transforms the optimization parameter values into valid RGB space and applies optional
additional functions.
Parameters:
Name | Type | Description |
---|---|---|
t |
* | Input tensor |
decorrelate |
boolean | Decorrelate colors |
sigmoid |
boolean | Apply sigmoid |
normalize |
boolean | Normalize to 1.0 |
- Source: